/// <summary>
// CodeFx.MySqlProviders - .NET Providers for MySql using the framework CodeFx
// Laurent Morisseau
//
// This program is free software; you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation; either version 2 of the License, or
// (at your option) any later version.
//
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
// GNU General Public License for more details.
//
// You should have received a copy of the GNU General Public License
// along with this program; if not, write to the Free Software
// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
//
// Laurent Morisseau
/// </summary>
/// <author><a href="mailto:laurent.morisseau@gmail.com">Laurent Morisseau</a></author>

namespace CodeFx.MySqlProviders
{
	using System;
	using System.Text ;
	using System.Web;
	using System.Data;
    using CodeFx.Web;
    using MySql.Data.MySqlClient;

	public partial class Aspnet_profileDAL: DALBase
	{
		/// <summary>
		/// Enumeration de tous les champs de aspnet_profile
		/// <summary>
		public enum Fields 
		{ 
			#region Enumeration de tous les champs de aspnet_profile
UserId,
PropertyNames,
propertyValuesString,
PropertyValuesBinary,
LastUpdatedDate
			#endregion
		}
	
		#region Private Properties aspnet_profile
		/// <summary>
		/// Champ UserId de la table aspnet_profile
		/// </summary>
		/// <remarks>Membre de la cle primaire. Membre d'une cle etrangere. </remarks>
		private uint _UserId;

		/// <summary>
		/// Champ PropertyNames de la table aspnet_profile
		/// </summary>
		/// <remarks>Membre Non Nullable. </remarks>
		private string _PropertyNames = String.Empty;

		/// <summary>
		/// Champ propertyValuesString de la table aspnet_profile
		/// </summary>
		/// <remarks>Membre Non Nullable. </remarks>
		private string _propertyValuesString = String.Empty;

		/// <summary>
		/// Champ PropertyValuesBinary de la table aspnet_profile
		/// </summary>
		/// <remarks>Membre Non Nullable. </remarks>
		private byte[] _PropertyValuesBinary;

		/// <summary>
		/// Champ LastUpdatedDate de la table aspnet_profile
		/// </summary>
		/// <remarks>Membre Non Nullable. </remarks>
		private DateTime _LastUpdatedDate;

		#endregion
		
		#region Public Properties
		
		public uint UserId
		{
			get {return this._UserId;}
			set {
					if ( this._UserId != value)
					{
						this.IsTouched = (this._UserId != value);
						this._UserId = value;
					}
				}
		}

		public string PropertyNames
		{
			get {return this._PropertyNames;}
			set {
					if ( this._PropertyNames != value)
					{
						this.IsTouched = (this._PropertyNames != value);
						this._PropertyNames = value;
					}
				}
		}

		public string propertyValuesString
		{
			get {return this._propertyValuesString;}
			set {
					if ( this._propertyValuesString != value)
					{
						this.IsTouched = (this._propertyValuesString != value);
						this._propertyValuesString = value;
					}
				}
		}

		public byte[] PropertyValuesBinary
		{
			get {return this._PropertyValuesBinary;}
			set {
					if ( this._PropertyValuesBinary != value)
					{
						this.IsTouched = (this._PropertyValuesBinary != value);
						this._PropertyValuesBinary = value;
					}
				}
		}

		public DateTime LastUpdatedDate
		{
			get {return this._LastUpdatedDate;}
			set {
					if ( this._LastUpdatedDate != value)
					{
						this.IsTouched = (this._LastUpdatedDate != value);
						this._LastUpdatedDate = value;
					}
				}
		}
		
		public string Key
        {
			get
			{
        	   	return this._UserId.ToString();
        	}
		}
		#endregion
		
		#region Override Methods
		public void Clone(Aspnet_profileDAL dataObject)
        {
            if (dataObject == null)
                throw new ArgumentNullException("dataObject");
            	this._PropertyNames = dataObject.PropertyNames;
            	this._propertyValuesString = dataObject.propertyValuesString;
            	this._PropertyValuesBinary = dataObject.PropertyValuesBinary;
            	this._LastUpdatedDate = dataObject.LastUpdatedDate;
        }
		
       	public override sealed string ToString()
        {
            StringBuilder Text = new StringBuilder( this.GetType().FullName );
			Text.AppendFormat( "\r\n \t{0} {2}: {1}", "UserId", this.UserId, "PK FK " );
			Text.AppendFormat( "\r\n \t{0} {2}: {1}", "PropertyNames", this.PropertyNames, "" );
			Text.AppendFormat( "\r\n \t{0} {2}: {1}", "propertyValuesString", this.propertyValuesString, "" );
			Text.AppendFormat( "\r\n \t{0} {2}: {1}", "PropertyValuesBinary", this.PropertyValuesBinary, "" );
			Text.AppendFormat( "\r\n \t{0} {2}: {1}", "LastUpdatedDate", this.LastUpdatedDate, "" );
			return Text.ToString();
        }
		
		public override sealed void Read(IDataReader reader)
        {
            if (reader == null)
                throw new ArgumentNullException("reader");
            base.Read(reader);
			MySqlDataReader myreader = (MySqlDataReader)reader;
this._UserId= myreader.GetUInt32((int)Aspnet_profileDAL.Fields.UserId);
this._PropertyNames= myreader.GetString((int)Aspnet_profileDAL.Fields.PropertyNames);
this._propertyValuesString= myreader.GetString((int)Aspnet_profileDAL.Fields.propertyValuesString);
this._PropertyValuesBinary= myreader.GetValue((int)Aspnet_profileDAL.Fields.PropertyValuesBinary) as byte[];
this._LastUpdatedDate= myreader.GetDateTime((int)Aspnet_profileDAL.Fields.LastUpdatedDate);
        }

        public override sealed void Write(IDbCommand cmd)
        {
			if (cmd == null)
                throw new ArgumentNullException("cmd");
            base.Write(cmd);
cmd.Parameters.Add(new MySqlParameter("?UserId", this._UserId));
cmd.Parameters.Add(new MySqlParameter("?PropertyNames", this._PropertyNames));
cmd.Parameters.Add(new MySqlParameter("?propertyValuesString", this._propertyValuesString));
cmd.Parameters.Add(new MySqlParameter("?PropertyValuesBinary", this._PropertyValuesBinary));
cmd.Parameters.Add(new MySqlParameter("?LastUpdatedDate", this._LastUpdatedDate));
        }

		public override sealed void WriteId(IDbCommand cmd)
        {
            if (cmd == null)
                throw new ArgumentNullException("cmd");
            base.WriteId(cmd);
cmd.Parameters.Add(new MySqlParameter("?UserId", this._UserId));
        }
        #endregion
				
	}
}
